import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:wowhy/service_locator.dart';
import 'package:wowhy/services/navigate_service.dart';

import 'state.dart';

Widget buildView(
    IndexPageState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    bottomNavigationBar: viewService.buildComponent('bottom_navbar'),
    floatingActionButton: FloatingActionButton(
      heroTag: 'publish_button',
      child: Icon(Icons.add),
      onPressed: () {
        getIt<NavigateService>().pushNamed('demo');
      },
    ),
    floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
    body: IndexedStack(
      index: state.activeIndex,
      children: state.pages,
    ),
  );
}
